﻿using System;

namespace Mvc.XForms.Controls.Settings {
	public class XFormSettings<TContext> {
		public IXForm<TContext> XForm { get; set; }

		public XFormSettings(IXForm<TContext> xform) {
			XForm = xform;
		}

		public void Form(Action<IXForm<TContext>> form) {
			XForm.Form = form;
			XForm.Render();
		}

		public XFormSettings<TContext> Method(SubmissionMethod method) {
			XForm.DefaultSubmission.Method = method;
			return this;
		}

		public XFormSettings<TContext> Action(string action) {
			XForm.DefaultSubmission.Resource = action;

			return this;
		}
	}
}
